# while
n = 1
sum = 0
while n < 101:
    sum += n
    n += 1  # 判断条件一定要更新
print("1+...+100的和为：%d" %sum)

# for
# 计算输入数字的阶乘的和，如：1!+2!+3!+4!
n = int(input("请输入数字："))
result, multiple = 0, 1
for i in range(1, n+1):
    multiple *= i
    result += multiple
print("阶乘为：%d" %result)

# 循环控制
# break, 判断一个数字n是否是质数（除了1和它本身不能被整除）
target = int(input("请输入一个数字，判断是否为质数："))
for i in range(2, target):
    if target % i == 0:
        print("%d 不是质数" %target)
        break
else:
    print("%d 是质数" %target)
# continue
for i in range(5):
    if i % 2 == 0:
        continue
    print(i)  # 1 3